﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BiliBiliCSharpStudy.clazz.ch27.d04 {
    class PatternDemo04 {
        public static void Demo() {
            Vehicle v = new Car();
            v.Run();
            v.Stop();
        }
    }

    class Vehicle {
        public void Stop() {
            Console.WriteLine("Stopped!");
        }
        public virtual void Run() {
            Console.WriteLine("Vehicle is running...");
        }
    }

    class Car : Vehicle {
        public override void Run() {
            Console.WriteLine("Car is running...");
        }
    }

    class Truck : Vehicle {
        public override void Run() {
            Console.WriteLine("Truck is running...");
        }
    }
}
